package callback.wait.asynCallback;

import callback.wait.SyncCallback.MyCallback;
import callback.wait.SyncCallback.Server;

public class ClientAsyn {



        Server server;

        public ClientAsyn(Server server) {
            this.server = server;
        }

//        public void request(final String msg) throws InterruptedException {
//            System.out.println("客户端发送请求消息：" + msg);
//            server.response(new MyCallback(),msg);
//            System.out.println("客户端已经发消息给服务器端，请稍等。。。");
//        }

    public void request(final String msg) throws InterruptedException {
        System.out.println("客户端发送请求消息：" + msg);
        new Thread(()->{
            try {
                server.response(new MyCallback(),msg);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();
        System.out.println("客户端已经发消息给服务器端，请稍等。。。");
    }



}
